<ng-container *ngFor="let item of treeData">
    <ng-container *ngIf="item.is_leaf;else submenu01">
        <li nz-menu-item nzMatchRouter>
            <i nz-icon [nzType]="item.menu_icon || 'file-text'"></i>
            <a [routerLink]="item.menu_path" style="margin-left:10px">{{ item.menu_name }}</a>
        </li>
    </ng-container>

    <ng-template #submenu01>
        <li (nzOpenChange)="openHandler(item)" nz-submenu [nzTitle]="item.menu_name" [nzOpen]="item.expand"
            [nzIcon]="item.menu_icon || 'heart'">
            <ul *ngIf="item.children" [treeData]="item.children" app-menuitem></ul>
        </li>
    </ng-template>
</ng-container>

<!-- ng-container is a logical container to group HTML elements -->